home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11504 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  37 lines

  1. Newsgroups: comp.lang.c
  2. Path: howland.reston.ans.net!torn!sq!msb
  3. From: msb@sq.com (Mark Brader)
  4. Subject: Re: Help with C Date/Time Calc
  5. Message-ID: <1996Mar24.201410.14507@sq.com>
  6. Organization: SoftQuad Inc., Toronto, Canada
  7. References: <4irm8d$bev@dfw-ixnews5.ix.netcom.com> <4it4ru$h9c@fohnix.metronet.com>
  8. Date: Sun, 24 Mar 1996 20:14:10 GMT
  9.  
  10. Keith Zawila (kzawila@ix.netcom.com) wrote:
  11. > > I have the total number of seconds that have elapsed since 1/1/70,
  12. > > and need to calculate the current date/time.
  13.  
  14. Stan Milam (milam@fohnix.metronet.com) answered:
  15. > Check your manual for time(), localtime(), strftime(), ctime(), gmtime(), 
  16. > and mktime(). ...
  17.  
  18. Note that those functions work with an arithmetic type called time_t,
  19. which represents calendar times (i.e. date and time) in a manner NOT
  20. specified by the C standard.  On UNIX systems, this manner happens to
  21. be "the total number of seconds that have elapsed since 1/1/70".  Keith
  22. is probably using a UNIX system or he wouldn't have asked that particular
  23. question; if so, Stan has answered it.
  24.  
  25. However, if Keith is using some other kind of system that represents dates
  26. in a different manner, then this sort of problem does become tricky.  (Not
  27. inherently hard; it's a matter of simple arithmetic and doens't need
  28. explaining here in detail.  But it can be tricky to account for all the
  29. little quirks in our calendar, especially if you've never done it before.)
  30. -- 
  31. Mark Brader           "On our campus the UNIX system has proved to be not
  32. msb@sq.com             only an effective software tool, but an agent of
  33. SoftQuad Inc.          technical and social change within the University."
  34. Toronto                                              -- John Lions, 1979
  35.  
  36. My text in this article is in the public domain.
  37.